package com.bootdo.lvyou.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.lvyou.dao.LvyouCateDao;
import com.bootdo.lvyou.domain.LvyouCate;
import com.bootdo.lvyou.service.LvyouCateService;



@Service
public class LvyouCateServiceImpl implements LvyouCateService {
	@Autowired
	private LvyouCateDao lvyouCateDao;
	
	@Override
	public LvyouCate get(Long id){
		return lvyouCateDao.get(id);
	}
	
	@Override
	public List<LvyouCate> list(Map<String, Object> map){
		return lvyouCateDao.list(map);
	}

	@Override
	public List<LvyouCate> listByRough(Map<String, Object> map) {
		return lvyouCateDao.listByRough(map);
	}

	@Override
	public int count(Map<String, Object> map){
		return lvyouCateDao.count(map);
	}
	
	@Override
	public int save(LvyouCate lvyouCate){
	
		if(lvyouCate.getId() != null) {
			return lvyouCateDao.update(lvyouCate);
		}else {
			lvyouCate.setIsHot(0);
			return lvyouCateDao.save(lvyouCate);
		}		
	
		
	}
	
	@Override
	public int update(LvyouCate lvyouCate){
		return lvyouCateDao.update(lvyouCate);
	}
	
	@Override
	public int remove(Long id){
		return lvyouCateDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return lvyouCateDao.batchRemove(ids);
	}
	
}
